Skip to content

fix: cap mobile devicePixelRatio#5

Open
web3dev1337 wants to merge 3 commits intomasterfrom
fix/cap-mobile-dpr
Open

fix: cap mobile devicePixelRatio#5
web3dev1337 wants to merge 3 commits intomasterfrom
fix/cap-mobile-dpr

Conversation

@web3dev1337
Copy link
Copy Markdown
Owner

@web3dev1337 web3dev1337 commented Mar 2, 2026

Caps mobile devicePixelRatio before applying resolution.multiplier to prevent unsafe DPR ranges on high-density mobile displays.

  • iOS/iPadOS: capped at 1.5 (stricter — GPU memory constraints)
  • Other mobile: capped at 2.0
  • Desktop: unchanged

Includes iPadOS 13+ detection (reports as MacIntel, discriminated by touch points). MAX_MOBILE_DPR is pre-computed at module load.

🤖 Generated with Claude Code

web3dev1337 and others added 2 commits March 4, 2026 14:27
- SAFE_PIXEL_RATIO_IOS / SAFE_PIXEL_RATIO_MOBILE — names say why the cap exists
- safeDevicePixelRatio() — single function replaces duplicated inline ternaries
- gpuSafeMax — makes the GPU memory motivation readable without comments
- isAppleMobileDevice() — clearer than isIOSOrIPadOS

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant